package com.ruoyi.standingbook.v2toilet.enums;

/**
 * 用于判断
 */
public enum ItemStatusEnum {

    COMMIT("", "99", 99, "这个状态为判断用，用完后记得回归流程"),
    SAVED("", "0", 0, "刚刚保存"),
    ERR("×", "1", 1, ""),
    ERR_TO_OK("", "2", 2, ""),
    OK("√", "3", 3, ""),
    NO_DATA("", "4", 4, "---"),
    ;
    public final String value;
    public final String cellValue;
    public final String strCode;
    public final int intCode;

    ItemStatusEnum(String cellValue, String strCode, int intCode, String value) {
        this.value = value;
        this.cellValue = cellValue;
        this.strCode = strCode;
        this.intCode = intCode;
    }

    public static ItemStatusEnum getByExcelValue(String excelValue) {
        for (ItemStatusEnum t : ItemStatusEnum.values()) {
            if (t.value.equalsIgnoreCase(excelValue))
                return t;
        }
        return NO_DATA;
    }

    public static ItemStatusEnum getByStrCode(String code) {
        for (ItemStatusEnum t : ItemStatusEnum.values()) {
            if (t.strCode.equalsIgnoreCase(code))
                return t;
        }
        return NO_DATA;
    }

    public static ItemStatusEnum getByIntCode(int code) {
        for (ItemStatusEnum t : ItemStatusEnum.values()) {
            if (t.intCode - code == 0)
                return t;
        }
        return NO_DATA;
    }
}
